package com.mqy.ssm.contriller.advice;

import com.mqy.ssm.dto.Result;
import com.mqy.ssm.exception.MyBaseException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 13159 //作者
 * @version V1.0 //版本
 * @Project case1
 * @Package com.mqy.ssm.contriller.advice
 * @Description:
 * @Date 2022/3/10 15:13//日期
 * @Motto:放下杂念,只为迎接明天更好的自己
 */

@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {

    @ExceptionHandler(MyBaseException.class)
    public Result processMyBaseExc(MyBaseException exception){
        return Result.setError(exception.getCode(),exception.getMessage(),null);
    }

}
